package ro.prj.manager.diff.model;

import java.net.URLClassLoader;
import java.net.URL;
import java.util.Date;
import java.util.GregorianCalendar;

public class JarsClassLoader extends URLClassLoader
{
    public JarsClassLoader( URL[] urls, ClassLoader parent )
    {
        super( urls, parent );
    }

    public Class<?> loadClass( String name )
            throws ClassNotFoundException
    {
        Class loadedClass = findLoadedClass( name );
        if( loadedClass == null )
        {
            try
            {
                loadedClass = findClass( name );
            }
            catch( ClassNotFoundException e )
            {
                // Swallow exception
                //does not exist locally
            }

            if( loadedClass == null )
            {
                loadedClass = super.loadClass( name );
            }
        }
        return loadedClass;
    }

    public static void main(String[] args) {
        String code="CB";


        boolean isB=code.equalsIgnoreCase("B");

        StringBuffer sb=new StringBuffer("RO");
        sb.append("%1$tY%1$tm%1$td");
        if(isB)
            sb.append("*%2$S");
        else
            sb.append("%2$2S");

        sb.append("%3$S");
        sb.append("%4$08d");

        String s =

                       String.format(sb.toString(), new Date(), code, "P17C1", 4);



               System.out.println(s);

               System.out.println(s.length());


        String s2 = String.format("Duke's Birthday: %1$tm %1$te,%1$tY",new GregorianCalendar());
        System.out.println(s2);


    }



}
